<%@page contentType="text/html;charset=UTF-8" language = "java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<html>
	<head>
		<title>JWiki</title>
		<link rel="stylesheet" href="texts/style.css" type="text/css" />
		<script type="text/javascript" src="texts/wiky.js"></script>
		<script type="text/javascript">
		/* <![CDATA[ */
		function load_funcs(){
		var text = document.getElementById('rec-content').innerHTML;
		text = Wiky.toHtml(text);
		document.getElementById('rec-content').innerHTML = text;
		};
		/* ]]> */
		</script>
	</head>
	<body onload=load_funcs()>
		<div id="page-wrapper">
			<c:import url="header.jsp"/>
			<c:import url="sidebar.jsp"/>
			<div id="content">
				<c:import url="s_navs.jsp"/>
				<h2>系统首页</h2>
				<div id="top-content">
				<div id="rec-item">
				<h2><c:out value="${item.title}"/></h2>
				<div id="rec-content">
				<c:choose>
					<c:when test="${fn:length(item.content) > 280}">
<c:out value="${fn:substring(item.content, 0, 280)}..." />
					</c:when>
					<c:otherwise>
<c:out value="${item.content}" />
					</c:otherwise>
				</c:choose>
				</div>
				<p style="margin-left:50px; clear:both;"><a href="page.do?action=read&id=<c:out value="${item.itemId}"/>">&gt;&gt;More</a></p>
				</div>
				<div id="newest">
				<h2>最新内容</h2>
				<ul>
				<c:forEach items="${new_items}" var="item">
					<li><span><a href="page.do?action=read&id=<c:out value="${item.itemId}"/>"><c:out value="${item.title}"/></a></span>: 
				<span class="excerpt"><c:choose>
					<c:when test="${fn:length(item.content) > 8}">
						<c:out value="${fn:substring(item.content, 0, 8)}..." />
					</c:when>
					<c:otherwise>
						<c:out value="${item.content}" />
					</c:otherwise>
					</c:choose>
				</span></li>
				</c:forEach>
				</ul>
				</div>
				</div>
				<div class="clear"></div>
				<div id="others">
					<h2>系统目录</h2>
					<ul class="list">
					<c:forEach items="${catelogs}" var="item">
						<li><a href="page.do?action=read&id=<c:out value="${item.itemId}"/>"><c:out value="${item.title}"/></a></li>
					</c:forEach>
					</ul>
					<div class="clear"></div>
					<h2>系统文件</h2>
					<ul class="list">
					<c:forEach items="${files}" var="item">
						<li><a href="page.do?action=read&id=<c:out value="${item.itemId}"/>"><c:out value="${item.title}"/></a></li>
					</c:forEach>
					</ul>
				</div>
			</div>
			<c:import url="footer.jsp"/>
		</div>
	</body>
</html>